package com.wan.adapter

import android.content.Context
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.wan.R
import com.wan.entity.HomeArtItemEntity

class ProjectItemAdapter(context: Context, data: ArrayList<HomeArtItemEntity>, itemViewId: Int) : BaseRecyclerAdapter<HomeArtItemEntity>(context, data, itemViewId) {

    override fun convert(holder: BaseViewHolder, itemEntity: HomeArtItemEntity, position: Int) {
        holder.setText(R.id.project_page_author_tv, "${itemEntity.author}")
        holder.setText(R.id.project_page_first_tv, "${itemEntity.title}")
        holder.setText(R.id.project_page_second_tv, "${itemEntity.desc}")
        holder.setText(R.id.project_page_date_tv, "${itemEntity.niceDate}")
        var imageView = holder.getView<ImageView>(R.id.project_page_img_iv)
        var requestOptions = RequestOptions()
        requestOptions.placeholder(R.mipmap.ic_launcher)
        Glide.with(context)
                .load(itemEntity.envelopePic)
                .apply(requestOptions)
                .into(imageView)
    }

}